package com.ruoyi.car.service.carmanage.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.car.pojo.TbCarScrap;
import com.ruoyi.car.mapper.carmanage.TbCarScrapMapper;
import com.ruoyi.car.service.carmanage.TbCarScrapService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbCarScrapServiceImpl implements TbCarScrapService {


    @Autowired
    private TbCarScrapMapper tbScrapMapper;

    /*@Override
    public List<TbCarScrap> selectTbScrapList() {
        return tbScrapMapper.selectList(null);
    }*/

    @Override
    public List<TbCarScrap> selectTbScrapList(Long carId, String recycleCrditCode) {
        QueryWrapper<TbCarScrap> queryWrapper = new QueryWrapper<TbCarScrap>();
        queryWrapper.like(carId != null,"car_id",carId);
        queryWrapper.like(recycleCrditCode != null,"recycle_crdit_code",recycleCrditCode);

        return tbScrapMapper.selectList(queryWrapper);
    }



    @Override
    public int scrapInsert(TbCarScrap tbCarScrap) {
        return tbScrapMapper.insert(tbCarScrap);
    }


    @Override
    public TbCarScrap selectTbCarScrapById(Long id) {
        return tbScrapMapper.selectById(id);
    }

    @Override
    public int scrapUpdate(TbCarScrap tbCarScrap) {
        return tbScrapMapper.updateById(tbCarScrap);
    }

    @Override
    public int deleteTbCarScrapByIds(String ids) {
        return tbScrapMapper.deleteById(ids);
    }

    @Override
    public int deleteTbCarScrapById(Long id) {
        return tbScrapMapper.deleteById(id);
    }
}
